package com.bluetoothsms.common;

public class MessageRequest extends BluetoothMessage {

	public enum RequestType {
		Unknown, ContactsList, SmsList, ThreadList, Conversation, SmsLatest, Calendar, CalendarList, CallLog
	}

	public MessageRequest(RequestType type) {
		super(BtMessageType.Request, new String[] { String.valueOf(type
				.ordinal()) });
	}

	public MessageRequest(RequestType type, int intParam) {
		super(BtMessageType.Request, new String[] {
				String.valueOf(type.ordinal()), String.valueOf(intParam) });
	}

	public MessageRequest(byte[] data, int length) {
		super(BtMessageType.Request, data, length);
	}

	public RequestType getType() {
		int ordinal = Integer.valueOf(mData[0]);

		if (ordinal >= 0 && ordinal < RequestType.values().length)
			return RequestType.values()[ordinal];
		else
			return RequestType.Unknown;
	}

	public int getIntParam() {
		return Integer.valueOf(mData[1]);
	}

}
